<!DOCTYPE html >
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>用户列表</title>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/common.css}">
</head>

<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">layout demo</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="">nav 1</a></li>
            <li class="layui-nav-item"><a href="">nav 2</a></li>
            <li class="layui-nav-item"><a href="">nav 3</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">nav groups</a>
                <dl class="layui-nav-child">
                    <dd><a href="">menu 11</a></dd>
                    <dd><a href="">menu 22</a></dd>
                    <dd><a href="">menu 33</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"
                         class="layui-nav-img">
                    tester
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">set 1</a></dd>
                    <dd><a href="">set 2</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">Sign out</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">menu group 1</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">menu item 1-1</a></dd>
                        <dd><a href="javascript:;">menu item 1-2</a></dd>
                        <dd><a href="javascript:;">menu item 1-3</a></dd>
                        <dd><a href="">the links</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">menu group 2</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">list 2-1</a></dd>
                        <dd><a href="javascript:;">list 2-2</a></dd>
                        <dd><a href="">超链接</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="javascript:;">menu item 123</a></li>
                <li class="layui-nav-item"><a href="">the links</a></li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
            <form class="layui-form layui-col-space5" th:action="@{/admin/userList}" method="post">
                <div class="layui-inline layui-show-xs-block">
                    <input type="text" name="username"  placeholder="请输入用户名" autocomplete="off" class="layui-input" th:value="${username}">
                </div>
                <div class="layui-inline layui-show-xs-block">
                    <button type="submit" class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                </div>
            </form>
            <table class="layui-table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>用户名</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="user:${allUser.getList()}">
                    <td th:text="${user.userId}"></td>
                    <td th:text="${user.username}"></td>
                    <td class="td-manage">
                        <a class="layui-btn">
                            <i class="layui-icon">&#xe642;</i>
                            编辑
                        </a>
                        <a class="layui-btn layui-btn-danger">
                            <i class="layui-icon">&#xe640;</i>
                            删除
                        </a>
                    </td>
                </tr>
                </tbody>
            </table>
            <!-- 分页导航条 -->
            <div class="row">
                <div class="col-md-6">
                    当前第[[${allUser.pageNum}]]页，共[[${allUser.pages}]]页，共[[${allUser.total}]]条记录 </div>
            </div>
            <!-- 分页导航条 -->
            <div class="layui-box layui-laypage layui-laypage-default" style="margin: 0; padding: 0;border-collapse: collapse;">
                <a th:href="@{/admin/userList/(username=${username})}" style="margin: 0;padding: 0;border-collapse: collapse;"><span class="btn-page btn-default">首页</span></a>
                <a th:href="@{/admin/userList/(pageNum=${allUser.hasPreviousPage}?${allUser.prePage}:1, username=${username})}" style="margin: 0;padding: 0;border-collapse: collapse;"><span
                        class="btn-page btn-default">上一页</span></a>
                <a th:each="page,pageStat:${allUser.navigatepageNums}" th:href="@{/admin/userList/(pageNum=${page},username=${username})}" style="margin: 0;padding: 0;border-collapse: collapse;">
                    <span th:if="${page}==${allUser.pageNum}" class="layui-laypage-curr">
                        <em class="layui-laypage-em"></em>
                        <em th:text="${page}"></em>
<!--                        <span class="btn-page btn-active" th:text="${page}"></span>-->
                    </span>
                    <span th:if="${page}!=${allUser.pageNum}" >
                        <em class="layui-laypage-em"></em>
                        <em th:text="${page}"></em>
                        <!--<span class="btn-page btn-default" th:text="${page}"></span>-->
                    </span>
                </a>
                <a th:href="@{/admin/userList/(pageNum=${allUser.hasNextPage}?${allUser.nextPage}:${allUser.pages},username=${username})}" style="margin: 0;padding: 0"><span
                        class="btn-page btn-default">下一页</span></a>
                <a th:href="@{/admin/userList/(pageNum=${allUser.pages},username=${username})}" style="margin: 0;padding: 0"><span class="btn-page btn-default" >尾页</span></a>
            </div>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        底部固定区域
    </div>
</div>

<script th:src="@{/layui/layui.js}"></script>
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        var element = layui.element;

    });
</script>
</body>
</html>